/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package GameLogic;

import Enums.*;

/*
 * @author RikuXan + Mastre
 */
public class Player
{
    //Die Schlange des Spielers
    private Snake snake;

    //Die Punktzahl des Spielers
    private int score;

    public Player()
    {
        snake = new Snake();
        score = 0;
    }

    public void setSnakeLength( int length )
    {
        snake.setSnakeLength( length );
    }

    public void checkSize()
    {
        if( snake.getElementCount() < snake.getSnakeLength() )
            snake.eat();
        else if( snake.getElementCount() > snake.getSnakeLength() )
            snake.setSnakeLength( snake.getSnakeLength() - 1 );
    }

    public void resetSnake()
    {
        snake.reset();
    }

    public boolean ElementInstanceof( int pos , Class c )
    {
        return snake.ElementInstanceof( pos , c );
    }

    public void setHead( int x , int y )
    {
        snake.setHeadCoords( x , y );
    }

    public void addElement(int x , int y)
    {
        snake.addElement(x , y);
    }

    public int getScore()
    {
        return score;
    }

    public void setScore(int newScore)
    {
        score = newScore;
    }

    public void move()
    {
        snake.move();
    }

    public void setSnakeOrientation(Direction newOrientation)
    {
        snake.setOrientation(newOrientation);
    }

    public Direction getSnakeOrientation()
    {
        return snake.getOrientation();
    }


    public int getElementPosX(int position)
    {
        return snake.getPosX(position);
    }

    public int getElementPosY(int position)
    {
        return snake.getPosY(position);
    }

    public int getSnakeElementCount()
    {
        return snake.getElementCount();
    }

    public String getTexture( int position )
    {
        return snake.getTexture( position );
    }

    public void eat()
    {
        snake.eat();
    }
}
